#ifndef CAMERA_H
#define CAMERA_H


#include <vector>

#include "PolyPlane.h"

enum {LEFT_PLANE, RIGHT_PLANE, TOP_PLANE, BOTTOM_PLANE, NEAR_PLANE, FAR_PLANE};


class Camera{

	float view_matrix_[16];
	float projection_matrix_[16];

	float world_position_[3];

	Plane frustum_planes_[6];
	bool is_orthographic_;

public:

	Camera(float* center, float* target, float* up);
	~Camera();

	const float* const view_matrix(){
		return view_matrix_;
	}

	const Plane* const frustum_planes(){
		return frustum_planes_;
	}
	
	const float* projection_matrix(){
		return projection_matrix_;
	}

	const float* world_position(){
		return world_position_;
	}

	const bool is_orthographic() {
		return is_orthographic_;
	}

	void Perspective(float angle, float aspect, float near, float far);
	void Orthographic(float left, float right, float top, float down, float near, float far);

	void UpdatePlanes();
	bool IsInFrustum(Poly& polygon);
	bool IsInFrustum(float bbox[8][3]);

	void Move(float* v, float delta_time);
	void Rotate(float* v, float delta_time);

};

#endif
